//
//  CaseManageViewController.m
//  KYProject
//
//  Created by Roman on 16/12/20.
//  Copyright © 2016年 Roman. All rights reserved.
//

#import "CaseManageViewController.h"
#import "CasePersonView.h"
#import "AddCaseController.h"


@interface CaseManageViewController ()<UITableViewDelegate,UITableViewDataSource>

@end
static NSString *cellID = @"CaseManage";
@implementation CaseManageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    
    
   
    [self setupUI];
   
}

- (void)setupUI
{
    UITableView *tableView = [[UITableView alloc]init];
    tableView.dataSource = self;
    tableView.delegate = self;
    
    tableView.rowHeight = 80;
    [self.view addSubview:tableView];
    
    //注册
    [tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:cellID];
    
    
    UIButton *button = [UIButton new];
    [button setTitle:@"添加病历" forState:UIControlStateNormal];
    [button setBackgroundColor:[UIColor blueColor]];
    [self.view addSubview:button];
    [button addTarget:self action:@selector(clickButton:) forControlEvents:UIControlEventTouchUpInside];
    
    [button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).mas_offset(-20);
        make.trailing.equalTo(self.view).mas_offset(-70);
        make.leading.equalTo(self.view).mas_offset(70);
        make.height.mas_equalTo(40);
    }];
    
    button.layer.cornerRadius = 10;
    button.clipsToBounds = YES;
    
    
}
- (void)clickButton:(UIButton *)button
{
    AddCaseController *caseVC = [[AddCaseController alloc]init];
    
    [self.navigationController pushViewController:caseVC animated:YES];

}

#pragma mark
#pragma mark - 数据源

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return 5;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
}


#pragma mark -- 组头
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
     CasePersonView *headView = [CasePersonView new];
   
    return headView;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    
    return 100;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}




@end
